#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<sys/wait.h>
#include<sys/types.h>


int main()
{
    pid_t id = fork();
    if(id == 0)
    {
        printf("pid: %d exec command begin\n",getpid());
        //execl("./mytest","mytest",NULL);
        //execl("/usr/bin/bash","bash","test.sh",NULL);
        execl("/usr/bin/python3","python","test.py",NULL);
        //execl("/usr/bin/ls","ls","-a","-l",NULL);
        //execlp("pwd","pwd",NULL);
       //char *const argv[] = {
       //     "ls",
       //     "-a",
       //     "-l",
       //     NULL 
       // };
       // //execv("/usr/bin/ls",argv);
       // //execlp("pwd","pwd",NULL);
       // //execvp(argv[0],argv);
       // execvp(argv[0],argv);
       // printf("pid: %d exec command end\n",getpid());
       // exit(0);
    }
    else 
    {
        //father
        pid_t rid = waitpid(-1,NULL,0);
        if(rid > 0)
        {
            printf("wait success,rid: %d\n",rid);
        }   
    }
    return 0;
}
